package com.weilai.domain;

import java.util.Date;

public class Posts {
    // 对应表字段定义属性
    private int id;
    private int userId;
    private String title;
    private String content;
    private String type;
    private String status;
    private int categoryId;
    private String categoryName;
    private String imageUrl;
    private int viewCount;
    private int likeCount;
    private int commentCount;
    private int shareCount;
    private String createdAt;
    private String updatedAt;
    //临时存储是否被点赞过
    private int isLiked;

    @Override
    public String toString() {
        return "Posts{" +
                "id=" + id +
                ", userId=" + userId +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", type='" + type + '\'' +
                ", status='" + status + '\'' +
                ", categoryId=" + categoryId +
                ", categoryName='" + categoryName + '\'' +
                ", imageUrl='" + imageUrl + '\'' +
                ", viewCount=" + viewCount +
                ", likeCount=" + likeCount +
                ", commentCount=" + commentCount +
                ", shareCount=" + shareCount +
                ", createdAt='" + createdAt + '\'' +
                ", updatedAt='" + updatedAt + '\'' +
                '}';
    }

    // 无参构造函数，用于创建对象时不传入参数
    public Posts() {
    }

    // 有参构造函数，用于创建对象时一次性传入所有属性值
    public Posts(int id, int userId, String title, String content, String type, String status,  int categoryId,String categoryName,String imageUrl, int viewCount, int likeCount, int commentCount, int shareCount, Date createdAt, Date updatedAt) {
        this.id = id;
        this.userId = userId;
        this.title = title;
        this.content = content;
        this.type = type;
        this.status = status;
        this.categoryId = categoryId;
        this.categoryName = categoryName;
        this.imageUrl = imageUrl;
        this.viewCount = viewCount;
        this.likeCount = likeCount;
        this.commentCount = commentCount;
        this.shareCount = shareCount;
        this.createdAt = String.valueOf(createdAt);
        this.updatedAt = String.valueOf(updatedAt);
    }

    // id属性的getter方法，用于获取id值
    public int getId() {
        return id;
    }
    // id属性的setter方法，用于设置id值
    public void setId(int id) {
        this.id = id;
    }

    // userId属性的getter方法
    public int getUserId() {
        return userId;
    }
    // userId属性的setter方法
    public void setUserId(int userId) {
        this.userId = userId;
    }

    // title属性的getter方法
    public String getTitle() {
        return title;
    }
    // title属性的setter方法
    public void setTitle(String title) {
        // 原代码这里有错误，已修正
        this.title = title;
    }

    // content属性的getter方法
    public String getContent() {
        return content;
    }
    // content属性的setter方法
    public void setContent(String content) {
        this.content = content;
    }

    // type属性的getter方法
    public String getType() {
        return type;
    }
    // type属性的setter方法
    public void setType(String type) {
        this.type = type;
    }

    // status属性的getter方法
    public String getStatus() {
        return status;
    }
    // status属性的setter方法
    public void setStatus(String status) {
        this.status = status;
    }


    // categoryId属性的getter方法
    public int getCategoryId() {
        return categoryId;
    }
    // categoryId属性的setter方法
    public void setCategoryId(int categoryId) {
        this.categoryId = categoryId;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }
    public String getImageUrl() {
        return imageUrl;
    }
    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    // viewCount属性的getter方法
    public int getViewCount() {
        return viewCount;
    }
    // viewCount属性的setter方法
    public void setViewCount(int viewCount) {
        this.viewCount = viewCount;
    }

    // likeCount属性的getter方法
    public int getLikeCount() {
        return likeCount;
    }
    // likeCount属性的setter方法
    public void setLikeCount(int likeCount) {
        this.likeCount = likeCount;
    }

    // commentCount属性的getter方法
    public int getCommentCount() {
        return commentCount;
    }
    // commentCount属性的setter方法
    public void setCommentCount(int commentCount) {
        this.commentCount = commentCount;
    }

    // shareCount属性的getter方法
    public int getShareCount() {
        return shareCount;
    }
    // shareCount属性的setter方法
    public void setShareCount(int shareCount) {
        this.shareCount = shareCount;
    }

    // createdAt属性的getter方法
    public String getCreatedAt() {
        return createdAt;
    }
    // createdAt属性的setter方法
    public void setCreatedAt(String createdAt) {
        this.createdAt = createdAt;
    }

    // updatedAt属性的getter方法
    public String getUpdatedAt() {
        return updatedAt;
    }
    // updatedAt属性的setter方法
    public void setUpdatedAt(String updatedAt) {
        this.updatedAt = updatedAt;
    }

    public int getIsLiked() {
        return isLiked;
    }

    public void setIsLiked(int isLiked) {
        this.isLiked = isLiked;
    }
}